package com.xx.job.controller.system;


import com.xx.job.common.PageResult;
import com.xx.job.common.Result;
import com.xx.job.controller.dto.PageDTO;
import com.xx.job.entity.system.SysCategory;
import com.xx.job.service.system.SysCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import com.xx.job.controller.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangcy
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/api/v1")
public class SysCategoryController extends BaseController {

    @Autowired
    private SysCategoryService sysCategoryService;

    @RequestMapping("/syscategoryList")
    public Result syscategoryList(PageDTO pageDTO, SysCategory sysCategory){
        PageResult pageResult = sysCategoryService.selectPage(pageDTO, sysCategory);
        return Result.success(pageResult);
    }

    @PostMapping("/syscategory")
    public Result addOperlog(@RequestBody SysCategory sysOperaLog){
        return Result.success(sysCategoryService.add(sysOperaLog));
    }

    @DeleteMapping("/syscategory/{id}")
    public Result deleteOperlog(@PathVariable Long id){
        return Result.success(sysCategoryService.delete(id));
    }

    @PutMapping("/syscategory")
    public Result updateOperlog(@RequestBody SysCategory sysOperaLog){
        return Result.success(sysCategoryService.update(sysOperaLog));
    }

    @GetMapping("/syscategory/{id}")
    public Result selectOperlog(@PathVariable Long id){
        return Result.success(sysCategoryService.select(id));
    }

}

